//
//  ContactKeyBoardCollectionVoew.m
//  CollectionTestDemo1.0
//
//  Created by Lisa on 16/7/27.
//  Copyright © 2016年 潘丽莎. All rights reserved.
//

#import "ContactKeyBoardCollectionView.h"
#import "ContactKepboardCollectionViewCell.h"

@interface ContactKeyBoardCollectionView ()<UICollectionViewDataSource>

@property (nonatomic,strong)NSMutableArray *mutDataArray;


@end

@implementation ContactKeyBoardCollectionView

-(id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
    if (self == [super initWithFrame:frame collectionViewLayout:layout])
    {
        [self intSubViews];
        [self installArray];
        self.dataSource = self;
        self.backgroundColor = [UIColor clearColor];
        
    }
    return self;
}


-(void)intSubViews
{
    [self registerNib:[ContactKepboardCollectionViewCell nibForContactKepboardCollectionViewCell] forCellWithReuseIdentifier:kContactKepboardCollectionViewCellID];
    
}
- (void)installArray
{
    self.mutDataArray = [NSMutableArray array];
    NSDictionary *dicOne = @{@"imageName":@"photoButtonBg",@"name":@"图片"};
    NSDictionary *dicTwo = @{@"imageName":@"takePhotoBg",@"name":@"拍摄"};
    NSDictionary *dicThree = @{@"imageName":@"smallVideoButtonBg",@"name":@"小视频"};
    NSDictionary *dicFour = @{@"imageName":@"voiceButtonBg",@"name":@"语音通话"};
    NSDictionary *dicFive = @{@"imageName":@"videoButtonBg",@"name":@"视频聊天"};
    NSDictionary *dicSix = @{@"imageName":@"collectButotnBg",@"name":@"收藏"};
    
    [self.mutDataArray addObject:dicOne];
    [self.mutDataArray addObject:dicTwo];
//    [self.mutDataArray addObject:dicThree];
//    [self.mutDataArray addObject:dicFour];
//    [self.mutDataArray addObject:dicFive];
//    [self.mutDataArray addObject:dicSix];
    
    
}

#pragma mark---UICollectionViewDelegate && UICollectionViewDatasource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.mutDataArray.count;
}

//每个UICollectionView展示的内容
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    ContactKepboardCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kContactKepboardCollectionViewCellID forIndexPath:indexPath];
    [cell updateContactKepboardCollectionViewCellDic:self.mutDataArray[indexPath.row]];
    return cell;
}


@end
